Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Using the VIEW-AS phrase for data representation objects
Many visual objects represent a single data value. This value can be a field from a database table or it can be a program variable. In both these cases, the default visual representation of the field is normally a fill-in field.
Why specify normally? You can define a visualization for a field when you create it as part of a database table definition in the Data Dictionary.
![]()
To see an example of how you define a field’s visualization:
- From the AppBuilder menu, select Tools
Data Dictionary.
- From the Sports2000 database, select the Item table. This table holds information about the different sports-related items that customers can order from your business.
- Click the Fields icon and select the CatDescription field from the Fields list. This field contains the full description of an Item in the catalog.
- Click the Field Properties button.
- In the Field Properties dialog box, click the View-As button.
A dialog box appears where you can define a default visualization for a field if you want it to be an object other than a fill-in. In this case, there is a definition for the field:
![]()
The CatDescription field is defined to be viewed as an editor object, with a size of 41 characters by 5 lines and a vertical scrollbar. Whenever you select the CatDescription field and drop it onto a frame in the AppBuilder, Progress automatically visualizes it as an editor of this description. If you define a variable to be
LIKEthe CatDescription field, it inherits these visual attributes along with the rest of the field description. You can change these attributes in your programs just as you can change the display for any other field, but the default is always to view it as an editor.- Cancel your way out of the dialog boxes and the Data Dictionary to return to the AppBuilder main window.
For all fields where there is no specific
VIEW-ASdefinition in the Data Dictionary, the default visualization is a fill-in field. If you want another visualization of the field, you use aVIEW-ASphrase as part of the object definition. There are several variations on this.In a
DEFINE VARIABLEstatement, you can append theVIEW-ASphrase to the definition:
The
optionsare attributes for that visual type that you can choose, such as theSIZEof the editor and theSCROLLBAR-VERTICALkeyword.If you’re not defining a variable but simply placing a database field or other field into a frame, then you append the
VIEW-ASphrase to the name of the field in theDEFINE FRAMEstatement, along with whatever options apply. Here’s an example from the frame definition the AppBuilder generates if you drop the Customer Comments field onto a window and define it as an editor, as you’ll do later in the next chapter:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |